home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Blitter / DrawRGBLine.s < prev    next >
Encoding:
Text File  |  1998-05-15  |  2.6 KB  |  121 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;This demo draws an RGB line which you can control with the mouse.
  3.  
  4.     INCDIR    "GMSDev:Includes/"
  5.     INCLUDE    "dpkernel/dpkernel.i"
  6.  
  7.     SECTION    "Demo",CODE
  8.  
  9. ;===========================================================================;
  10. ;                             INITIALISE DEMO
  11. ;===========================================================================;
  12.  
  13.     STARTDPK
  14.  
  15. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  16.     move.l    DPKBase(pc),a6
  17.     lea    ScreenTags(pc),a0
  18.     sub.l    a1,a1
  19.     CALL    Init
  20.     tst.l    d0
  21.     beq.s    .Exit
  22.  
  23.     moveq    #ID_JOYDATA,d0
  24.     CALL    Get
  25.     move.l    d0,JoyData
  26.     beq.s    .Exit
  27.     move.l    d0,a0
  28.     sub.l    a1,a1
  29.     CALL    Init
  30.     tst.l    d0
  31.     beq.s    .Exit
  32.  
  33.     move.l    Screen(pc),a0
  34.     CALL    Display
  35.  
  36.     bsr.s    Main
  37.  
  38. .Exit    move.l    DPKBase(pc),a6
  39.     move.l    JoyData(pc),a0
  40.     CALL    Free
  41.     move.l    Screen(pc),a0
  42.     CALL    Free
  43.     MOVEM.L    (SP)+,A0-A6/D1-D7
  44.     moveq    #ERR_OK,d0
  45.     rts
  46.  
  47. ;===========================================================================;
  48. ;                                MAIN LOOP
  49. ;===========================================================================;
  50.  
  51. Main:
  52. .loop    move.l    DPKBase(pc),a6
  53.     move.l    Screen(pc),a0
  54.     move.l    GS_Bitmap(a0),a0
  55.     CALL    Clear
  56.  
  57.     move.l    JoyData(pc),a0
  58.     CALL    Query
  59.  
  60.     move.l    JoyData(pc),a0
  61.     move.l    JD_Buttons(a0),d0
  62.     btst    #JB_RMB,d0
  63.     bne.s    .done
  64.     lea    MouseDXY(pc),a1
  65.     btst    #JB_LMB,d0
  66.     beq.s    .no
  67.  
  68.     lea    MouseSXY(pc),a1
  69. .no    move.w    JD_YChange(a0),d0
  70.     add.w    d0,2(a1)
  71.     move.w    JD_XChange(a0),d0
  72.     add.w    d0,(a1)
  73.  
  74. .Draw    move.l    BLTBase(pc),a6
  75.     move.l    Screen(pc),a0
  76.     move.l    GS_Bitmap(a0),a0
  77.     movem.w    MouseSXY(pc),d1/d2/d3/d4    ;d1 = XStart, YStart, XEnd, YEnd.
  78.     move.l    #$ffffff,d5    ;d5 = Colour
  79.     move.l    #$ffff0000,d6
  80.     CALL    bltDrawRGBLine
  81.  
  82.     move.l    SCRBase(pc),a6
  83.     CALL    scrWaitAVBL
  84.     move.l    Screen(pc),a0
  85.     CALL    scrSwapBuffers
  86.     bra.s    .loop
  87.  
  88. .done    rts
  89.  
  90. ;===========================================================================;
  91. ;                                  DATA
  92. ;===========================================================================;
  93.  
  94. MouseSXY:    dc.w  160,128
  95. MouseDXY:    dc.w  40,40
  96.  
  97. JoyData:    dc.l  0
  98. ScreenTags:    dc.l  TAGS_SCREEN
  99. Screen:        dc.l  0
  100.         dc.l  GSA_Width,640
  101.         dc.l  GSA_Height,256
  102.         dc.l  GSA_ScrMode,SM_HIRES
  103.         dc.l  GSA_Attrib,SCR_DBLBUFFER
  104.         dc.l    GSA_BitmapTags,0
  105.         dc.l    BMA_Palette,.palette
  106.         dc.l    TAGEND,0
  107.         dc.l  TAGEND
  108.  
  109. .palette    dc.l  PALETTE_ARRAY,4
  110.         dc.l  $000000,$f0f0f0,$f000f0,$f00000
  111.  
  112. ;===========================================================================;
  113.  
  114. ProgName:    dc.b  "Draw RGB Line",0
  115. ProgAuthor:    dc.b  "Paul Manias",0
  116. ProgDate:    dc.b  "May 1998",0
  117. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  118. ProgShort:    dc.b  "Simple line demonstration.",0
  119.         even
  120.  
  121.